import { Entity, Column, PrimaryGeneratedColumn, UpdateDateColumn, ManyToOne, JoinColumn, OneToMany } from 'typeorm';
import { ApiProperty} from '@nestjs/swagger';
import { CommentPicture } from './comment_picture.entity';
import { IsOptional } from 'class-validator';
import { Product } from './product.entities';

@Entity()
export class Collect {
  @PrimaryGeneratedColumn({type: 'mediumint'})
  id: number;

  @Column({type: 'mediumint', nullable: false})
  user_id: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'mediumint',nullable: false, comment:"产品Id"})
  value_id: number;

  @Column({type: 'int'})
  add_time: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'tinyint',width:1})
  is_attention: number;

  @IsOptional()
  @ApiProperty()
  @Column({type: 'int'})
  type_id: number;

  @ManyToOne(type => Product,product => product.collect)
  @JoinColumn({
    name:"value_id"
  })
  product:Product
}
